package com.thz.system.controller.user;

import com.thz.common.core.controller.BaseController;
import com.thz.common.core.pojo.TableDataInfo;
import com.thz.common.core.result.Result;
import com.thz.system.pojo.user.dto.UserDTO;
import com.thz.system.pojo.user.dto.UserQueryDTO;
import com.thz.system.service.user.IUserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description
 * @Author thz
 * @Date 2025/3/26
 */
@RestController
@RequestMapping("/user")
@Tag(name="C端用户管理接口文档")
@Slf4j
public class UserController extends BaseController {

    @Autowired
    private IUserService userService;

    @GetMapping("/list")
    public TableDataInfo list(UserQueryDTO userQueryDTO) {
        return getTableDataInfo(userService.list(userQueryDTO));
    }

    @PutMapping("/updateStatus")
    @Operation(summary = "拉黑、解禁", description = "拉黑：限制用户操作   解禁：放开对于用户限制")
    // 更新数据库中用户的状态信息。
    public Result updateStatus(@RequestBody UserDTO userDTO) {
        return UToResult(userService.updateStatus(userDTO));
    }

}
